<template>
	<view class="warp">
		<view class="example-info">首页</view>
		<view class="example-title">基本信息</view>
		<view class="example-body">
			<uni-grid :column="3" :highlight="true" @change="change">
				<uni-grid-item v-for="(item, index) in list" :key="index">
					<image :src="item.url" class="image" mode="aspectFill" />
					<text class="text">{{ item.text }}</text>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	import uniGrid from "@/components/uni-grid/uni-grid.vue"
	import uniGridItem from "@/components/uni-grid-item/uni-grid-item.vue"
	
	export default {
		components: { uniGrid, uniGridItem },
		data() {
			return {
				list: [{
						url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1571630728024&di=92beb205f55e507f585834807a508889&imgtype=0&src=http%3A%2F%2Fwww.sj520.cn%2Fsc%2Fima%2F20161004144725_22421.jpg',
						text: '我的商品'
					},
					{
						url: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3480975263,3307347329&fm=26&gp=0.jpg',
						text: '发布商品'
					},
					{
						url: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1571631123284&di=5d52b8685938596b737f74f4234f0369&imgtype=0&src=http%3A%2F%2Fphoto.16pic.com%2F00%2F20%2F14%2F16pic_2014222_b.jpg',
						text: '商品库'
					},
					{
						url: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3563104431,406602570&fm=26&gp=0.jpg',
						text: '店面销售'
					},
				]
			}
		},
		onLoad() {
		},
		methods: {
			change(e) {
				let { index } = e.detail
				console.log(index)
				if (index === 0) {
					uni.navigateTo({
					    url: '../index/index'
					});
				} else if (index === 1) {
					uni.navigateTo({
					    url: '../user/addGood'
					});
				} else if (index === 2) {
					uni.navigateTo({
					    url: '../stock/stock'
					});
				} else if (index === 3) {
					uni.navigateTo({
					    url: '../sale/sale'
					});
				}
			}
		}
	}
</script>

<style scoped>
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #efeff4
	}
	
	view {
		font-size: 28upx;
		line-height: inherit
	}
	
	.example {
		padding: 0 30upx 30upx
	}
	
	.example-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 32upx;
		color: #464e52;
		padding: 30upx 30upx 30upx 50upx;
		margin-top: 20upx;
		position: relative;
		background-color: #fdfdfd;
		border-bottom: 1px #f5f5f5 solid
	}
	
	.example-title__after {
		position: relative;
		color: #031e3c
	}
	
	.example-title:after {
		content: '';
		position: absolute;
		left: 30upx;
		margin: auto;
		top: 0;
		bottom: 0;
		width: 6upx;
		height: 32upx;
		background-color: #ccc
	}
	
	.example .example-title {
		margin: 40upx 0
	}
	
	.example-body {
		padding: 30upx;
		background: #fff
	}
	
	.example-info {
		padding: 30upx;
		color: #3b4144;
		background: #fff
	}
	
	.image {
		width: 50upx;
		height: 50upx;
	}
	
	.text {
		font-size: 26upx;
		margin-top: 10upx;
	}
</style>
